home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 946850 (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  20.5 KB  |  676 lines

  1. package com.sun.java.swing.text;
  2.  
  3. import com.sun.java.accessibility.Accessible;
  4. import com.sun.java.accessibility.AccessibleContext;
  5. import com.sun.java.swing.Action;
  6. import com.sun.java.swing.JComponent;
  7. import com.sun.java.swing.KeyStroke;
  8. import com.sun.java.swing.Scrollable;
  9. import com.sun.java.swing.UIManager;
  10. import com.sun.java.swing.event.CaretEvent;
  11. import com.sun.java.swing.event.CaretListener;
  12. import com.sun.java.swing.event.EventListenerList;
  13. import com.sun.java.swing.plaf.TextUI;
  14. import java.awt.AWTEvent;
  15. import java.awt.Color;
  16. import java.awt.Component;
  17. import java.awt.Container;
  18. import java.awt.Dimension;
  19. import java.awt.Insets;
  20. import java.awt.LayoutManager;
  21. import java.awt.Point;
  22. import java.awt.Rectangle;
  23. import java.awt.Toolkit;
  24. import java.awt.datatransfer.Clipboard;
  25. import java.awt.datatransfer.ClipboardOwner;
  26. import java.awt.datatransfer.DataFlavor;
  27. import java.awt.datatransfer.StringSelection;
  28. import java.awt.datatransfer.Transferable;
  29. import java.awt.event.ActionEvent;
  30. import java.awt.event.InputEvent;
  31. import java.awt.event.KeyEvent;
  32. import java.io.IOException;
  33. import java.io.ObjectInputStream;
  34. import java.io.Reader;
  35. import java.io.Writer;
  36. import java.util.Hashtable;
  37.  
  38. public abstract class JTextComponent extends JComponent implements Scrollable, Accessible {
  39.    public static final String FOCUS_ACCELERATOR_KEY = "focusAcceleratorKey";
  40.    private Document model;
  41.    private transient Caret caret;
  42.    private transient Highlighter highlighter;
  43.    private transient Keymap keymap;
  44.    private boolean opaque;
  45.    private transient MutableCaretEvent caretEvent;
  46.    private Color caretColor;
  47.    private Color selectionColor;
  48.    private Color selectedTextColor;
  49.    private Color disabledTextColor;
  50.    private boolean editable;
  51.    private Insets margin;
  52.    private char focusAccelerator;
  53.    private Action focusAction = new FocusAction(this);
  54.    private static ClipboardOwner defaultClipboardOwner = new ClipboardObserver();
  55.    private static Hashtable keymapTable = null;
  56.    private JTextComponent editor;
  57.    private static JTextComponent focusedComponent;
  58.    public static final String DEFAULT_KEYMAP = "default";
  59.    static final KeyBinding[] defaultBindings = new KeyBinding[]{new KeyBinding(KeyStroke.getKeyStroke(8, 0), "delete-previous"), new KeyBinding(KeyStroke.getKeyStroke(127, 0), "delete-next"), new KeyBinding(KeyStroke.getKeyStroke(39, 0), "caret-forward"), new KeyBinding(KeyStroke.getKeyStroke(37, 0), "caret-backward")};
  60.    static Class class$com$sun$java$swing$event$CaretListener;
  61.  
  62.    static {
  63.       try {
  64.          keymapTable = new Hashtable(17);
  65.          Keymap binding = addKeymap("default", (Keymap)null);
  66.          binding.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction());
  67.          EditorKit kit = new DefaultEditorKit();
  68.          loadKeymap(binding, defaultBindings, kit.getActions());
  69.       } catch (Throwable var2) {
  70.          var2.printStackTrace();
  71.          keymapTable = new Hashtable(17);
  72.       }
  73.  
  74.    }
  75.  
  76.    public JTextComponent() {
  77.       ((Component)this).enableEvents(8L);
  78.       this.caretEvent = new MutableCaretEvent(this);
  79.       ((Component)this).addMouseListener(this.caretEvent);
  80.       ((Component)this).addFocusListener(this.caretEvent);
  81.       this.setEditable(true);
  82.       ((Container)this).setLayout((LayoutManager)null);
  83.       this.updateUI();
  84.    }
  85.  
  86.    public void addCaretListener(CaretListener listener) {
  87.       EventListenerList var10000 = super.listenerList;
  88.       Class var10001 = class$com$sun$java$swing$event$CaretListener;
  89.       if (var10001 == null) {
  90.          try {
  91.             var10001 = Class.forName("com.sun.java.swing.event.CaretListener");
  92.          } catch (ClassNotFoundException var2) {
  93.             throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  94.          }
  95.  
  96.          class$com$sun$java$swing$event$CaretListener = var10001;
  97.       }
  98.  
  99.       var10000.add(var10001, listener);
  100.    }
  101.  
  102.    public static Keymap addKeymap(String nm, Keymap parent) {
  103.       Keymap map = new DefaultKeymap(nm, parent);
  104.       if (nm != null) {
  105.          keymapTable.put(nm, map);
  106.       }
  107.  
  108.       return map;
  109.    }
  110.  
  111.    public void copy() {
  112.       try {
  113.          Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  114.          int p0 = Math.min(this.caret.getDot(), this.caret.getMark());
  115.          int p1 = Math.max(this.caret.getDot(), this.caret.getMark());
  116.          if (p0 != p1) {
  117.             Document doc = this.getDocument();
  118.             String srcData = doc.getText(p0, p1 - p0);
  119.             StringSelection contents = new StringSelection(srcData);
  120.             clipboard.setContents(contents, defaultClipboardOwner);
  121.          }
  122.       } catch (BadLocationException var7) {
  123.       }
  124.  
  125.    }
  126.  
  127.    public void cut() {
  128.       try {
  129.          Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  130.          int p0 = Math.min(this.caret.getDot(), this.caret.getMark());
  131.          int p1 = Math.max(this.caret.getDot(), this.caret.getMark());
  132.          if (p0 != p1) {
  133.             Document doc = this.getDocument();
  134.             String srcData = doc.getText(p0, p1 - p0);
  135.             StringSelection contents = new StringSelection(srcData);
  136.             clipboard.setContents(contents, defaultClipboardOwner);
  137.             doc.remove(p0, p1 - p0);
  138.          }
  139.       } catch (BadLocationException var7) {
  140.       }
  141.  
  142.    }
  143.  
  144.    protected void fireCaretUpdate(CaretEvent e) {
  145.       Object[] listeners = super.listenerList.getListenerList();
  146.  
  147.       for(int i = listeners.length - 2; i >= 0; i -= 2) {
  148.          Object var10000 = listeners[i];
  149.          Class var10001 = class$com$sun$java$swing$event$CaretListener;
  150.          if (var10001 == null) {
  151.             try {
  152.                var10001 = Class.forName("com.sun.java.swing.event.CaretListener");
  153.             } catch (ClassNotFoundException var4) {
  154.                throw new NoClassDefFoundError(((Throwable)var4).getMessage());
  155.             }
  156.  
  157.             class$com$sun$java$swing$event$CaretListener = var10001;
  158.          }
  159.  
  160.          if (var10000 == var10001) {
  161.             ((CaretListener)listeners[i + 1]).caretUpdate(e);
  162.          }
  163.       }
  164.  
  165.    }
  166.  
  167.    public AccessibleContext getAccessibleContext() {
  168.       if (super.accessibleContext == null) {
  169.          super.accessibleContext = new AccessibleJTextComponent(this);
  170.       }
  171.  
  172.       return super.accessibleContext;
  173.    }
  174.  
  175.    public Action[] getActions() {
  176.       return this.getUI().getEditorKit().getActions();
  177.    }
  178.  
  179.    public Caret getCaret() {
  180.       return this.caret;
  181.    }
  182.  
  183.    public Color getCaretColor() {
  184.       return this.caretColor;
  185.    }
  186.  
  187.    public int getCaretPosition() {
  188.       return this.caret.getDot();
  189.    }
  190.  
  191.    public Color getDisabledTextColor() {
  192.       return this.disabledTextColor;
  193.    }
  194.  
  195.    public Document getDocument() {
  196.       return this.model;
  197.    }
  198.  
  199.    public char getFocusAccelerator() {
  200.       return this.focusAccelerator;
  201.    }
  202.  
  203.    static final JTextComponent getFocusedComponent() {
  204.       return focusedComponent;
  205.    }
  206.  
  207.    public Highlighter getHighlighter() {
  208.       return this.highlighter;
  209.    }
  210.  
  211.    public Keymap getKeymap() {
  212.       return this.keymap;
  213.    }
  214.  
  215.    public static Keymap getKeymap(String nm) {
  216.       return (Keymap)keymapTable.get(nm);
  217.    }
  218.  
  219.    public Insets getMargin() {
  220.       return this.margin == null ? ((TextUI)super.ui).getDefaultMargin() : this.margin;
  221.    }
  222.  
  223.    public Dimension getPreferredScrollableViewportSize() {
  224.       return ((JComponent)this).getPreferredSize();
  225.    }
  226.  
  227.    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
  228.       switch (orientation) {
  229.          case 0:
  230.             return visibleRect.width;
  231.          case 1:
  232.             return visibleRect.height;
  233.          default:
  234.             throw new IllegalArgumentException("Invalid orientation: " + orientation);
  235.       }
  236.    }
  237.  
  238.    public boolean getScrollableTracksViewportHeight() {
  239.       return false;
  240.    }
  241.  
  242.    public boolean getScrollableTracksViewportWidth() {
  243.       return false;
  244.    }
  245.  
  246.    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
  247.       switch (orientation) {
  248.          case 0:
  249.             return visibleRect.width / 10;
  250.          case 1:
  251.             return visibleRect.height / 10;
  252.          default:
  253.             throw new IllegalArgumentException("Invalid orientation: " + orientation);
  254.       }
  255.    }
  256.  
  257.    public String getSelectedText() {
  258.       String txt = null;
  259.       int p0 = Math.min(this.caret.getDot(), this.caret.getMark());
  260.       int p1 = Math.max(this.caret.getDot(), this.caret.getMark());
  261.       if (p0 != p1) {
  262.          try {
  263.             Document doc = this.getDocument();
  264.             txt = doc.getText(p0, p1 - p0);
  265.          } catch (BadLocationException var5) {
  266.             throw new IllegalArgumentException(((Throwable)var5).getMessage());
  267.          }
  268.       }
  269.  
  270.       return txt;
  271.    }
  272.  
  273.    public Color getSelectedTextColor() {
  274.       return this.selectedTextColor;
  275.    }
  276.  
  277.    public Color getSelectionColor() {
  278.       return this.selectionColor;
  279.    }
  280.  
  281.    public int getSelectionEnd() {
  282.       int end = Math.max(this.caret.getDot(), this.caret.getMark());
  283.       return end;
  284.    }
  285.  
  286.    public int getSelectionStart() {
  287.       int start = Math.min(this.caret.getDot(), this.caret.getMark());
  288.       return start;
  289.    }
  290.  
  291.    public String getText() {
  292.       Document doc = this.getDocument();
  293.  
  294.       String txt;
  295.       try {
  296.          txt = doc.getText(0, doc.getLength());
  297.       } catch (BadLocationException var3) {
  298.          txt = null;
  299.       }
  300.  
  301.       return txt;
  302.    }
  303.  
  304.    public String getText(int offs, int len) throws BadLocationException {
  305.       return this.getDocument().getText(offs, len);
  306.    }
  307.  
  308.    public TextUI getUI() {
  309.       return (TextUI)super.ui;
  310.    }
  311.  
  312.    public boolean isEditable() {
  313.       return this.editable;
  314.    }
  315.  
  316.    public boolean isFocusTraversable() {
  317.       return ((Component)this).isEnabled();
  318.    }
  319.  
  320.    public boolean isOpaque() {
  321.       return this.opaque;
  322.    }
  323.  
  324.    public static void loadKeymap(Keymap map, KeyBinding[] bindings, Action[] actions) {
  325.       Hashtable h = new Hashtable();
  326.  
  327.       for(int i = 0; i < actions.length; ++i) {
  328.          Action a = actions[i];
  329.          String value = (String)a.getValue("Name");
  330.          h.put(value != null ? value : "", a);
  331.       }
  332.  
  333.       for(int i = 0; i < bindings.length; ++i) {
  334.          Action a = (Action)h.get(bindings[i].actionName);
  335.          if (a != null) {
  336.             map.addActionForKeyStroke(bindings[i].key, a);
  337.          }
  338.       }
  339.  
  340.    }
  341.  
  342.    private final boolean mapEventToAction(KeyEvent e) {
  343.       Keymap binding = this.getKeymap();
  344.       if (binding != null) {
  345.          KeyStroke k = KeyStroke.getKeyStrokeForEvent(e);
  346.          Action a = binding.getAction(k);
  347.          if (a != null) {
  348.             String command = null;
  349.             if (e.getKeyChar() != 0) {
  350.                command = String.valueOf(e.getKeyChar());
  351.             }
  352.  
  353.             ActionEvent ae = new ActionEvent(this, 1001, command, ((InputEvent)e).getModifiers());
  354.             a.actionPerformed(ae);
  355.             ((InputEvent)e).consume();
  356.             return true;
  357.          }
  358.       }
  359.  
  360.       return false;
  361.    }
  362.  
  363.    public Rectangle modelToView(int pos) throws BadLocationException {
  364.       return this.getUI().modelToView(pos);
  365.    }
  366.  
  367.    public void moveCaretPosition(int pos) {
  368.       this.caret.moveDot(pos);
  369.    }
  370.  
  371.    public void paste() {
  372.       Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  373.       Transferable content = clipboard.getContents(this);
  374.       if (content != null) {
  375.          try {
  376.             String dstData = (String)content.getTransferData(DataFlavor.stringFlavor);
  377.             this.replaceSelection(dstData);
  378.          } catch (Exception var4) {
  379.             System.err.println("Couldn't get clipboard contents in format: " + DataFlavor.stringFlavor.getHumanPresentableName());
  380.          }
  381.       }
  382.  
  383.    }
  384.  
  385.    protected void processComponentKeyEvent(KeyEvent e) {
  386.       int id = ((AWTEvent)e).getID();
  387.       switch (id) {
  388.          case 400:
  389.             if (!this.mapEventToAction(e)) {
  390.                Keymap binding = this.getKeymap();
  391.                if (binding != null) {
  392.                   Action a = binding.getDefaultAction();
  393.                   if (a != null) {
  394.                      ActionEvent ae = new ActionEvent(this, 1001, String.valueOf(e.getKeyChar()), ((InputEvent)e).getModifiers());
  395.                      a.actionPerformed(ae);
  396.                      ((InputEvent)e).consume();
  397.                   }
  398.                }
  399.             }
  400.             break;
  401.          case 401:
  402.             this.mapEventToAction(e);
  403.             break;
  404.          case 402:
  405.             this.mapEventToAction(e);
  406.       }
  407.  
  408.    }
  409.  
  410.    public void read(Reader in, Object desc) throws IOException {
  411.       EditorKit kit = this.getUI().getEditorKit();
  412.       Document doc = kit.createDefaultDocument();
  413.       if (desc != null) {
  414.          doc.putProperty("stream", desc);
  415.       }
  416.  
  417.       try {
  418.          kit.read(in, doc, 0);
  419.          this.setDocument(doc);
  420.       } catch (BadLocationException var6) {
  421.          throw new IOException(((Throwable)var6).getMessage());
  422.       }
  423.    }
  424.  
  425.    private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
  426.       s.defaultReadObject();
  427.       this.caretEvent = new MutableCaretEvent(this);
  428.       ((Component)this).addMouseListener(this.caretEvent);
  429.       ((Component)this).addFocusListener(this.caretEvent);
  430.       this.getUI().installUI(this);
  431.    }
  432.  
  433.    public void removeCaretListener(CaretListener listener) {
  434.       EventListenerList var10000 = super.listenerList;
  435.       Class var10001 = class$com$sun$java$swing$event$CaretListener;
  436.       if (var10001 == null) {
  437.          try {
  438.             var10001 = Class.forName("com.sun.java.swing.event.CaretListener");
  439.          } catch (ClassNotFoundException var2) {
  440.             throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  441.          }
  442.  
  443.          class$com$sun$java$swing$event$CaretListener = var10001;
  444.       }
  445.  
  446.       var10000.remove(var10001, listener);
  447.    }
  448.  
  449.    public static Keymap removeKeymap(String nm) {
  450.       return (Keymap)keymapTable.remove(nm);
  451.    }
  452.  
  453.    public void replaceSelection(String content) {
  454.       if (!this.isEditable()) {
  455.          ((Component)this).getToolkit().beep();
  456.       } else {
  457.          Document doc = this.getDocument();
  458.          if (doc != null) {
  459.             try {
  460.                int p0 = Math.min(this.caret.getDot(), this.caret.getMark());
  461.                int p1 = Math.max(this.caret.getDot(), this.caret.getMark());
  462.                if (p0 != p1) {
  463.                   doc.remove(p0, p1 - p0);
  464.                }
  465.  
  466.                if (content != null && content.length() > 0) {
  467.                   doc.insertString(p0, content, (AttributeSet)null);
  468.                }
  469.             } catch (BadLocationException var5) {
  470.                ((Component)this).getToolkit().beep();
  471.             }
  472.          }
  473.  
  474.       }
  475.    }
  476.  
  477.    public void select(int selectionStart, int selectionEnd) {
  478.       this.setCaretPosition(selectionStart);
  479.       this.moveCaretPosition(selectionEnd);
  480.    }
  481.  
  482.    public void selectAll() {
  483.       Document doc = this.getDocument();
  484.       if (doc != null) {
  485.          this.setCaretPosition(0);
  486.          this.moveCaretPosition(doc.getLength());
  487.       }
  488.  
  489.    }
  490.  
  491.    public void setCaret(Caret c) {
  492.       if (this.caret != null) {
  493.          this.caret.removeChangeListener(this.caretEvent);
  494.          this.caret.deinstall(this);
  495.       }
  496.  
  497.       Caret old = this.caret;
  498.       this.caret = c;
  499.       if (this.caret != null) {
  500.          this.caret.install(this);
  501.          this.caret.addChangeListener(this.caretEvent);
  502.       }
  503.  
  504.       ((JComponent)this).firePropertyChange("caret", old, this.caret);
  505.    }
  506.  
  507.    public void setCaretColor(Color c) {
  508.       Color old = this.caretColor;
  509.       this.caretColor = c;
  510.       ((JComponent)this).firePropertyChange("caretColor", old, this.caretColor);
  511.    }
  512.  
  513.    public void setCaretPosition(int position) {
  514.       Document doc = this.getDocument();
  515.       if (doc != null) {
  516.          if (position > doc.getLength() || position < 0) {
  517.             throw new IllegalArgumentException("bad position: " + position);
  518.          }
  519.  
  520.          this.caret.setDot(position);
  521.       }
  522.  
  523.    }
  524.  
  525.    public void setDisabledTextColor(Color c) {
  526.       Color old = this.disabledTextColor;
  527.       this.disabledTextColor = c;
  528.       ((JComponent)this).firePropertyChange("disabledTextColor", old, this.disabledTextColor);
  529.    }
  530.  
  531.    public void setDocument(Document doc) {
  532.       if (super.accessibleContext != null) {
  533.          this.model.removeDocumentListener((AccessibleJTextComponent)super.accessibleContext);
  534.       }
  535.  
  536.       Document old = this.model;
  537.       this.model = doc;
  538.       ((JComponent)this).firePropertyChange("document", old, doc);
  539.       ((JComponent)this).revalidate();
  540.       ((Component)this).repaint();
  541.       if (super.accessibleContext != null) {
  542.          this.model.addDocumentListener((AccessibleJTextComponent)super.accessibleContext);
  543.       }
  544.  
  545.    }
  546.  
  547.    public void setEditable(boolean b) {
  548.       boolean oldVal = this.editable;
  549.       this.editable = b;
  550.       ((JComponent)this).firePropertyChange("editable", new Boolean(oldVal), new Boolean(this.editable));
  551.    }
  552.  
  553.    public void setEnabled(boolean b) {
  554.       super.setEnabled(b);
  555.       ((Component)this).repaint();
  556.    }
  557.  
  558.    public void setFocusAccelerator(char aKey) {
  559.       aKey = Character.toUpperCase(aKey);
  560.       KeyStroke[] keyStrokes = ((JComponent)this).getRegisteredKeyStrokes();
  561.       int i = 0;
  562.  
  563.       for(int c = keyStrokes.length; i < c; ++i) {
  564.          if (((JComponent)this).getActionForKeyStroke(keyStrokes[i]) == this.focusAction) {
  565.             if (keyStrokes[i].getKeyChar() == aKey) {
  566.                return;
  567.             }
  568.  
  569.             ((JComponent)this).unregisterKeyboardAction(keyStrokes[i]);
  570.             break;
  571.          }
  572.       }
  573.  
  574.       if (aKey != 0) {
  575.          ((JComponent)this).registerKeyboardAction(this.focusAction, KeyStroke.getKeyStroke(aKey, 8), 2);
  576.       }
  577.  
  578.       char old = this.focusAccelerator;
  579.       this.focusAccelerator = aKey;
  580.       ((JComponent)this).firePropertyChange("focusAcceleratorKey", old, this.focusAccelerator);
  581.    }
  582.  
  583.    public void setHighlighter(Highlighter h) {
  584.       if (this.highlighter != null) {
  585.          this.highlighter.deinstall(this);
  586.       }
  587.  
  588.       Highlighter old = this.highlighter;
  589.       this.highlighter = h;
  590.       if (this.highlighter != null) {
  591.          this.highlighter.install(this);
  592.       }
  593.  
  594.       ((JComponent)this).firePropertyChange("highlighter", old, h);
  595.    }
  596.  
  597.    public void setKeymap(Keymap map) {
  598.       Keymap old = this.keymap;
  599.       this.keymap = map;
  600.       ((JComponent)this).firePropertyChange("keymap", old, this.keymap);
  601.    }
  602.  
  603.    public void setMargin(Insets m) {
  604.       Insets old = this.margin;
  605.       this.margin = m;
  606.       ((JComponent)this).firePropertyChange("margin", old, m);
  607.       ((Container)this).invalidate();
  608.    }
  609.  
  610.    public void setOpaque(boolean o) {
  611.       this.opaque = o;
  612.    }
  613.  
  614.    public void setSelectedTextColor(Color c) {
  615.       Color old = this.selectedTextColor;
  616.       this.selectedTextColor = c;
  617.       ((JComponent)this).firePropertyChange("selectedTextColor", old, this.selectedTextColor);
  618.    }
  619.  
  620.    public void setSelectionColor(Color c) {
  621.       Color old = this.selectionColor;
  622.       this.selectionColor = c;
  623.       ((JComponent)this).firePropertyChange("selectionColor", old, this.selectionColor);
  624.    }
  625.  
  626.    public void setSelectionEnd(int selectionEnd) {
  627.       this.select(this.getSelectionStart(), selectionEnd);
  628.    }
  629.  
  630.    public void setSelectionStart(int selectionStart) {
  631.       this.select(selectionStart, this.getSelectionEnd());
  632.    }
  633.  
  634.    public void setText(String t) {
  635.       try {
  636.          Document doc = this.getDocument();
  637.          doc.remove(0, doc.getLength());
  638.          doc.insertString(0, t, (AttributeSet)null);
  639.       } catch (BadLocationException var3) {
  640.          ((Component)this).getToolkit().beep();
  641.       }
  642.  
  643.    }
  644.  
  645.    public void setUI(TextUI ui) {
  646.       super.setUI(ui);
  647.    }
  648.  
  649.    public void updateUI() {
  650.       this.setUI((TextUI)UIManager.getUI(this));
  651.       ((Container)this).invalidate();
  652.    }
  653.  
  654.    public int viewToModel(Point pt) {
  655.       return this.getUI().viewToModel(pt);
  656.    }
  657.  
  658.    public void write(Writer out) throws IOException {
  659.       Document doc = this.getDocument();
  660.  
  661.       try {
  662.          this.getUI().getEditorKit().write(out, doc, 0, doc.getLength());
  663.       } catch (BadLocationException var4) {
  664.          throw new IOException(((Throwable)var4).getMessage());
  665.       }
  666.    }
  667.  
  668.    static Document access$model(JTextComponent var0) {
  669.       return var0.model;
  670.    }
  671.  
  672.    static void access$focusedComponent(JTextComponent var0) {
  673.       focusedComponent = var0;
  674.    }
  675. }
  676.